package com.taijia.chapter9;

import java.util.Date;

/**
 *
 */
public class TestInterupt {
    public static void main(String[] args) {
        Thread mt = new MyThread();
        mt.start();
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
        }
        mt.interrupt();
    }
}

class MyThread extends Thread{
    @Override
    public void run() {
        while (true) {
            System.out.println("==="+new Date() + "===");
            try {
                sleep(1000);
            } catch (InterruptedException e) {
                return;
            }
        }
    }
}
